<template>
  <div id="box" v-loading="loading" element-loading-text="加载中">
    <iframe id="child" :src="url" scrolling="auto" frameborder="0" seamless >
      </iframe>
  </div>
</template>
<script>
// import { getPatientInfo } from '@/api/green-channel/tab-request'

export default {
  // 由主页面(父组件) 接收来的, 选择项的数据
  props: ['checkrowdata'], // 由主页面(父组件) 接收来的, 选择项的数据
  data() {
    return {
      url: '',
      loading: true
    }
  },
  computed: {},
  updated() {},
  created() {},
  mounted() {
    // 正式环境（暂未发布）
    // this.url = 'http://121.40.195.34:12334/strokeChoose?apiToken=' + this.$store.getters.apiToken + '&dispatchId=' + this.checkrowdata.dispatchId + '&medicalId=' + this.checkrowdata.medicalId + '&userId=' + this.$store.getters.userId

    // 测试环境
    this.url = process.env.VUE_APP_BASE_API_DATA_BRANCH + '/strokeChoose?apiToken=' + this.$store.getters.apiToken + '&dispatchId=' + this.checkrowdata.dispatchId + '&medicalId=' + this.checkrowdata.medicalId + '&userId=' + this.$store.getters.userId + '&type=' + 'web'
    // 我的环境
    // this.url = 'http://localhost/strokeChoose?apiToken=' + this.$store.getters.apiToken + '&dispatchId=' + this.checkrowdata.dispatchId + '&medicalId=' + this.checkrowdata.medicalId + '&userId=' + this.$store.getters.userId

    // this.url = 'http://localhost/stroke/CEA_CAS?apiToken=432c737055aa76f7df4d11eb4d6ac229&dispatchId=102925&medicalId=10031&userId=368'

    const iframes = document.getElementById('child')
    if (iframes.attachEvent) {
      iframes.attachEvent('onload', () => {
        // iframe加载完毕以后执行操作
        this.loading = false
        // console.log('iframe已加载完毕1')
      })
    } else {
      iframes.onload = () => {
        // iframe加载完毕以后执行操作
        // console.log('iframe已加载完毕2')
        this.loading = false
      }
    }
  },
  methods: {}
}
</script>
<!-- http://121.40.195.34:12334/strokeChoose?apiToken=0&dispatchId= -->
<style scoped>
  #child{
    width: 100%;
    height: 80vh;
  }
</style>
